package com.da.javatest.leetCode;

/**
 * @author chenlida
 * @date 2018/12/21 16:55
 * @description
 */
public class Code693 {
    public boolean hasAlternatingBits(int n) {
        char[] chars = Integer.toBinaryString(n).toCharArray();
        for (int i = 0; i < chars.length - 1; i++) {
            if (chars[i] == chars[i + 1]) { return false; }
        }
        return true;
    }
}
